//
//  RssList.m
//  iBole
//
//  Created by Tao Chen on 12-3-11.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
/*This file is part of iBole.
 
 iBole is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 iBole is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */
#import "RssList.h"
#import "RssParser.h"

@implementation RssList
{
    NSMutableArray * list;
}

@synthesize list;

-(id)init
{
    if (self = [super init] ) {
        list = [[NSMutableArray alloc] init];
    }
    return self;
}
-(void) dealloc
{
    [list release];
    [super dealloc];
}
-(void)getRssFromNetwork
{
    RssParser * parser = [[RssParser alloc] init];
    parser.delegate = self;
    [parser getRssFromNetwork];
    [parser release];
}
-(int) itemNumforPage: (int) page
{
    return [list count];
}
-(RssDetail *)detailAtIndex: (int) index
{
    assert(index < [list count]);
    return [list objectAtIndex:index];
}
-(void) itemBegin
{
    RssDetail * detail = [[RssDetail alloc] init];
    [self.list addObject:detail];
    [detail release];
}
-(void) itemTitle:(NSString *) title
{
    [[self.list lastObject] setTitle:title];
}
-(void) itemDetail:(NSString *)detail
{
    [[self.list lastObject] setDetail:detail];
}
-(void) itemEnd
{
    
}

@end
